package com.study.ming.shejimoshi.chain;

public abstract class AbstractLoggor {

	protected int level;
	AbstractLoggor nextLoggor;

	public void setNextLoggor(AbstractLoggor nextLoggor) {
		this.nextLoggor = nextLoggor;
	}
	
	public void logMsg(int level, String msg) {
		//level越低 打印的越多
		if(level <= this.level) {
			write(msg);
		}
		if(nextLoggor != null) {
			nextLoggor.logMsg(level, msg);
		}
		
	}

	protected abstract void write(String msg);

}
